package com.neusoft.neuiotms.dcom.model.insurance;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;
import com.neusoft.bizcore.web.jpa.model.Comment;
import com.neusoft.neuiotms.dcom.model.enums.InsuranceReportTaskStatus;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@Entity
@Table(name = "neuiot_insurance_report_task")
@org.hibernate.annotations.Table(appliesTo = "neuiot_insurance_report_task", comment = "重保服务每日上报任务表")
public class InsuranceReportTask extends AbstractAuditModel {

    private static final long serialVersionUID = -982494774937794644L;

    /** 任务编码 */
    @NotBlank(message = "任务编码 ")
    @Length(max = 255, message = "任务编码不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '任务编码 '")
    private String code;

    /** 上报人编码 */
    @Length(max = 255, message = "上报人编码不能超过{max}位")
    @Column(length = 255)
    @Comment("varchar(255) COMMENT '上报人编码'")
    private String reportPersonCode;

    /** 上报人名称 */
    @Length(max = 255, message = "上报人名称不能超过{max}位")
    @Column(length = 255)
    @Comment("varchar(255) COMMENT '上报人名称'")
    private String reportPersonName;

    /** 单位编码 */
    @NotBlank(message = "单位编码不能为空")
    @Length(max = 255, message = "单位编码不能超过{max}位")
    @Column(length = 255)
    @Comment("varchar(255) NOT NULL COMMENT '单位编码'")
    private String unitCode;

    /** 服务开始时间 */
    @Column(nullable = true)
    private Date startTime;

    /** 服务结束时间 */
    @Column(nullable = true)
    private Date endTime;

    /** cron表达式 */
    @Length(max = 255, message = "cron表达式不能超过{max}位")
    @Column(length = 255)
    @Comment("varchar(255) COMMENT cron表达式 '")
    private String cronExp;

    /** 日报排序 */
    @Column(length = 8, nullable = true)
    @Comment("int(8) NULL COMMENT '日报排序'")
    private Integer sorting;

    /** 是否正常 */
    @Comment("bit(1) NOT NULL COMMENT '是否正常'")
    private Boolean normal = true;

    /** 异常情况 */
    @Lob
    @Column(columnDefinition = "text")
    @Comment("text COMMENT '异常情况'")
    private String abnormalSituation;

    /** 每日上报任务状态 */
    @Enumerated(EnumType.STRING)
    @Column(length = 32, nullable = false)
    @Comment("varchar(32) NOT NULL COMMENT '任务状态'")
    private InsuranceReportTaskStatus status = InsuranceReportTaskStatus.notActive;

    /** 关联服务登记任务表 */
    @ManyToOne
    private InsuranceRegisterTask registerTask;

}
